package com.wen.controller.system;

import com.wen.common.utils.ResponseResult;
import com.wen.system.service.SysConfService;
import com.wen.common.pojo.system.SysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *
 * @author liwen <devinlive@163.com>
 * @version 1.0
 * @since 2022-12-17 00:09
 */
@RestController
@RequestMapping("/sysConf")
public class SysConfController {

    @Autowired
    private SysConfService sysConfService;

    @GetMapping("/queryServiceStatus")
    public ResponseResult<?> queryServiceStatus() throws Exception {
        final List<SysService> sysServices = sysConfService.serviceList();
        return ResponseResult.success(sysServices);
    }
    @PutMapping("/modServiceStatus")
    public ResponseResult<?> modServiceStatus(@RequestBody SysService service) throws Exception {
        System.out.println("132");
        return sysConfService.modServiceStatus(service.getServiceName(), service.getState());
    }
}
